package codec

import "io"

type Header struct {
	ServiceMethod string
	Seq	uint64
	Error string
}

// Codec 转码解码器
type Codec interface {
	io.Closer
	ReadHeader(*Header)error
	ReadBody(interface{})error
	Write(*Header,interface{})error
}

type NewCodecFunc func(io.ReadWriteCloser)Codec

type Type string
const (
	GobType Type = "application/gob"
	JsonType Type = "application/json"
)

var NewCodecFuncMap map[Type]NewCodecFunc

func init() {
	NewCodecFuncMap = make(map[Type]NewCodecFunc)
	NewCodecFuncMap[GobType] = NewGobCodec
}


